package org.leviatan.dataharbour.core.admin.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;

import org.leviatan.dataharbour.core.DataHarbourConfiguration;
import org.leviatan.dataharbour.core.model.DataEntity;
import org.leviatan.dataharbour.core.model.DataSource;
import org.leviatan.dataharbour.core.model.HarbourRequest;
import org.leviatan.dataharbour.core.model.PersistenceResource;
import org.leviatan.dataharbour.core.model.Sender;
import org.leviatan.dataharbour.core.model.control.DataEntityHandler;
import org.leviatan.dataharbour.core.model.control.DataSourceHandler;
import org.leviatan.dataharbour.core.model.control.HarbourRequestHandler;
import org.leviatan.dataharbour.core.model.control.PersistenceResourceHandler;
import org.leviatan.dataharbour.core.model.control.SenderHandler;
import org.leviatan.dataharbour.core.register.Register;
import org.leviatan.dataharbour.core.register.control.RegisterFileHandler;
import org.leviatan.dataharbour.core.register.control.RegisterXmlHandler;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * Heavily depends on DataHarbourConfiguration.
 * 
 * @author Leviatan
 *
 */
public abstract class RegisterHandler {
	
	
	
	public static void saveAllModelsOnFile() {
		RegisterHandler.storeDataSourceModelsOnFile();
		RegisterHandler.storePersistenceResourceModelsOnFile();
		RegisterHandler.storeSenderModelsOnFile();
	}
	
	
	///////////////////////////////////////////////////////////////////////////
	// File saves: Models
	///////////////////////////////////////////////////////////////////////////	
	public static void storeDataSourceModelsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.modelFileNameDataSources;
		
		Collection models = Register.getInstance().getDataSourceModels().values();
		
		Document dsDoc = RegisterXmlHandler.createMultipleDataModelsXmlDoc(models);
		RegisterFileHandler.storeXmlDocOnFile(dsDoc, filePath);
	}
	
	public static void storePersistenceResourceModelsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.modelFileNamePersistenceResources;
	
		Collection models = Register.getInstance().getPersistenceResourceModels().values();
	
		Document prDoc = RegisterXmlHandler.createMultipleDataModelsXmlDoc(models);
		RegisterFileHandler.storeXmlDocOnFile(prDoc, filePath);
	}
	
	public static void storeSenderModelsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
		DataHarbourConfiguration.modelFileNameSenders;

		Collection models = Register.getInstance().getSenderModels().values();
	
		Document sendersDoc = RegisterXmlHandler.createMultipleDataModelsXmlDoc(models);
		RegisterFileHandler.storeXmlDocOnFile(sendersDoc, filePath);
	}
	
	public static void storeHarbourRequestModelOnFile(String id) {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.subPathHarbourRequests +
			id + ".xml";
		HarbourRequest hr = Register.getInstance().getHarbourRequestModels().get(id);
		if (hr != null) {
			Document doc = RegisterXmlHandler.createSingleDataModelXmlDoc(hr);
			RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
		}
	}
	
	public static void storeDataEntityModelOnFile(String id) {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.subPathDataEntities +
			id + ".xml";
		DataEntity de = Register.getInstance().getDataEntityModels().get(id);
		if (de != null) {
			Document doc = RegisterXmlHandler.createSingleDataModelXmlDoc(de);
			RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
		}
	}

	

	
	///////////////////////////////////////////////////////////////////////////
	// File saves: Mappings
	///////////////////////////////////////////////////////////////////////////
	
	public static void storeDataSource2DefinatorTablesOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataSource2DefinatorTables;
		
		Map mapping = Register.getInstance().getDataSourceId2DefinatorTableIds();
		Document doc = RegisterXmlHandler.createMappingsXmlDoc(mapping);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeDataSource2PersistenceResourcesOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataSource2PersistenceResources;
		
		Map mapping = Register.getInstance().getDataSourceId2PersistenceResourceIds();
		Document doc = RegisterXmlHandler.createMappingsXmlDoc(mapping);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeDataEntity2DefinatorFieldsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataEntity2DefinatorFields;
		
		Map mapping = Register.getInstance().getDataEntityId2DefinatorFieldIds();
		Document doc = RegisterXmlHandler.createMappingsXmlDoc(mapping);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeHarbourRequest2DataEntitiesOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameHarbourRequest2DataEntities;
		Map mapping = Register.getInstance().getHarbourRequestId2DataEntityIds();
		Document doc = RegisterXmlHandler.createMappingsXmlDoc(mapping);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeSender2DataSourcesOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameSender2DataSources;
		
		Map mapping = Register.getInstance().getSenderId2DataSourceIds();
		Document doc = RegisterXmlHandler.createMappingsXmlDoc(mapping);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// File saves: Id lists
	///////////////////////////////////////////////////////////////////////////
	
	public static void storeUnpersistedHarbourRequestIdsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.listFileNameUnpersistedHarbourRequestIds;
		
		Collection<String> ids = Register.getInstance().getUnpersistedHarbourRequestIds();
		Document doc = RegisterXmlHandler.createIdListXmlDoc(ids);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeHarbourRequestIdsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.listFileNameHarbourRequestIds;
		
		Collection<String> ids = Register.getInstance().getHarbourRequestModels().keySet();
		Document doc = RegisterXmlHandler.createIdListXmlDoc(ids);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath);
	}
	
	public static void storeDataEntityIdsOnFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.listFileNameDataEntityIds;
		
		Collection<String> ids = Register.getInstance().getDataEntityModels().keySet();
		Document doc = RegisterXmlHandler.createIdListXmlDoc(ids);
		RegisterFileHandler.storeXmlDocOnFile(doc, filePath); 
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// File loads: Models
	///////////////////////////////////////////////////////////////////////////
	
	
	public static void loadDataSourcesFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.modelFileNameDataSources;
		
		RegisterHandler.addTypedModels(filePath, "ds");
	}
	
	public static void loadPersistenceResourcesFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.modelFileNamePersistenceResources;
		
		RegisterHandler.addTypedModels(filePath, "pr");
	}
	
	public static void loadSendersFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.modelFileNameSenders;
		
		RegisterHandler.addTypedModels(filePath, "s");
	}
	
	public static void loadHarbourRequestFromFile(String id) {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.subPathHarbourRequests +
			id + ".xml";
		
		Document singleMdlDoc = RegisterFileHandler.loadXmlDocFromFile(filePath);
		// only one model on item(0)
		Element e = (Element) RegisterXmlHandler.getDataModelsNodeList(singleMdlDoc).item(0);
		HarbourRequest hr = HarbourRequestHandler.instantiateModel(e);
		if (hr != null)
			RegisterHandler.addHarbourRequest(hr);
	}
	
	public static void loadDataEntityFromFile(String id) {
		String filePath = DataHarbourConfiguration.pathRegister + 
			DataHarbourConfiguration.subPathDataEntities +
			id + ".xml";
		
		Document singleMdlDoc = RegisterFileHandler.loadXmlDocFromFile(filePath);
		// only one model on item(0)
		Element e = (Element) RegisterXmlHandler.getDataModelsNodeList(singleMdlDoc).item(0);
		DataEntity de = DataEntityHandler.instantiateModel(e);
		if (de != null)
			RegisterHandler.addDataEntity(de);
	}
	
	public static void loadMultipleHarbourRequestsFromFile(Collection<String> hrIds) {
		for (String string : hrIds) {
			RegisterHandler.loadHarbourRequestFromFile(string);
		}
	}
	
	public static void loadMultipleDataEntitiesFromFile(Collection<String> dsIds) {
		for (String string : dsIds) {
			RegisterHandler.loadDataEntityFromFile(string);
		}
	}
	
	private static void addTypedModels(String filePath, String type) {
		
		Document doc = RegisterFileHandler.loadXmlDocFromFile(filePath);
		
		NodeList dsList = RegisterXmlHandler.getDataModelsNodeList(doc);
		
		for (int i = 0; i < dsList.getLength(); i++) {
			Element modelElem = (Element) dsList.item(i);
			
			if (type.equals("ds")) {
				DataSource ds = DataSourceHandler.instantiateModel(modelElem);
				RegisterHandler.addDataSource(ds);	
			}
			else if (type.equals("pr")) {
				PersistenceResource pr = PersistenceResourceHandler.instantiateModel(modelElem);
				RegisterHandler.addPersistenceResource(pr);
			}
			else if (type.equals("s")) {
				Sender s = SenderHandler.instantiateModel(modelElem);
				RegisterHandler.addSender(s);
			}
		}
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// File loads: Mappings
	///////////////////////////////////////////////////////////////////////////
	
	private static void addMapping(HashMap<String, TreeSet<String>> map, String fromId, String toId) {
		if (!map.containsKey(fromId)) {
			map.put(fromId, new TreeSet<String>());
		}
		map.get(fromId).add(toId);
	}
	
	private static void addTypedMappings(String filePath, String type) {
		Document doc = RegisterFileHandler.loadXmlDocFromFile(filePath);
		
		Hashtable<String, TreeSet<String>> mappings = RegisterXmlHandler.parseMapping(doc);
		
		for (Iterator<String> i = mappings.keySet().iterator(); i.hasNext(); ) {
			String fromId = i.next();
			TreeSet<String> toIds = mappings.get(fromId);
			for (Iterator<String> x = toIds.iterator(); x.hasNext(); ) {
				String toId = x.next();
				
				if (type.equals("ds2dt")) {
					RegisterHandler.addDataSource2DefinatorTableMapping(fromId, toId);
					
				} else if (type.equals("ds2pr")) {
					RegisterHandler.addDataSource2PersistenceResourceMapping(fromId, toId);
					
				} else if (type.equals("de2df")) {
					//RegisterHandler.addData
					
				} else if (type.equals("hr2de")) {
					RegisterHandler.addHarbourRequest2DataEntityMapping(fromId, toId);
					
				} else if (type.equals("s2ds")) {
					RegisterHandler.addSender2DataSourceMapping(fromId, toId);
					
				} else if (type.equals("s2hr")) {
					RegisterHandler.addSender2HarbourRequestMapping(fromId, toId);
					
				}
			}
		}
		
	}
	
	public static void loadDataSource2DefinatorTablesFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataSource2DefinatorTables;
		
		RegisterHandler.addTypedMappings(filePath, "ds2dt");
	}
	
	public static void loadDataSource2PersistenceResourcesFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataSource2PersistenceResources;
	
		RegisterHandler.addTypedMappings(filePath, "ds2pr");
	}
	
	public static void loadHarbourRequest2DataEntities() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameHarbourRequest2DataEntities;
	
		RegisterHandler.addTypedMappings(filePath, "hr2de");
	}
	
	public static void loadDataEntity2DefinatorFieldsFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameDataEntity2DefinatorFields;
	
		RegisterHandler.addTypedMappings(filePath, "de2df");
		
	}
	
	public static void loadSender2DataSourcesFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameSender2DataSources;
	
		RegisterHandler.addTypedMappings(filePath, "s2ds");
		
	}
	
	public static void loadSender2HarbourRequestsFromFile() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.mapFileNameSender2HarbourRequest;
	
		RegisterHandler.addTypedMappings(filePath, "s2hr");
		
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// File loads: Lists
	///////////////////////////////////////////////////////////////////////////
	
	
	public static void loadHarbourRequestIdList() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.listFileNameHarbourRequestIds;
		
		TreeSet<String> ids = RegisterHandler.getIdsFromXmlFile(filePath);
		
		for (String id : ids) {
			RegisterHandler.addHarbourRequestId(id);
		}
	}
	
	public static void loadUnpersistedHarbourRequestIdList() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.listFileNameUnpersistedHarbourRequestIds;
	
		TreeSet<String> ids = RegisterHandler.getIdsFromXmlFile(filePath);
		
		for (String id : ids) {
			RegisterHandler.addUnpersistedHarbourRequestId(id);
		}	
	}
	

	public static void loadDataEntityIdList() {
		String filePath = DataHarbourConfiguration.pathRegister +
			DataHarbourConfiguration.listFileNameDataEntityIds;
		
		for (String id : RegisterHandler.getIdsFromXmlFile(filePath) ) {
			RegisterHandler.addDataEntityId(id);
		}
	}
	
	private static TreeSet<String> getIdsFromXmlFile(String filePath) {
		Document doc = RegisterFileHandler.loadXmlDocFromFile(filePath);
		return RegisterXmlHandler.parseIdList(doc);
	}
	

	
	
	///////////////////////////////////////////////////////////////////////////
	// Adds + removes: Mappings
	///////////////////////////////////////////////////////////////////////////
	
	
	// ds2dt
	public static void addDataSource2DefinatorTableMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getDataSourceId2DefinatorTableIds(),
				fromId, toId);
	}
	
	// ds2dt remove
	public static void removeDataSource2DefinatorTableMapping(String fromId, String toId) {
		Register.getInstance().getDataSourceId2DefinatorTableIds().get(fromId).remove(toId);
	}
	
	// ds2pr
	public static void addDataSource2PersistenceResourceMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getDataSourceId2PersistenceResourceIds(),
				fromId, toId);
	}
	
	// ds2pr remove
	public static void removeDataSource2PersistenceResourceMapping(String fromId, String toId) {
		Register.getInstance().getDataSourceId2PersistenceResourceIds().get(fromId).remove(toId);
	}
	
	// de2df
	public static void addDataEntity2DefinatorFieldMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getDataEntityId2DefinatorFieldIds(),
				fromId, toId);
	}
	
	// de2df remove
	public static void removeDataEntity2DefinatorFieldMapping(String fromId, String toId) {
		Register.getInstance().getDataEntityId2DefinatorFieldIds().get(fromId).remove(toId);
	}
	
	// hr2de
	public static void addHarbourRequest2DataEntityMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getHarbourRequestId2DataEntityIds(),
				fromId, toId);
	}
	
	// hr2de remove
	public static void removeHarbourRequest2DataEntityMapping(String fromId, String toId) {
		Register.getInstance().getHarbourRequestId2DataEntityIds().get(fromId).remove(toId);
	}
	
	// s2ds
	public static void addSender2DataSourceMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getSenderId2DataSourceIds(),
				fromId, toId);
	}
	
	// s2ds remove
	public static void removeSender2DataSourceMapping(String fromId, String toId) {
		Register.getInstance().getSenderId2DataSourceIds().get(fromId).remove(toId);
	}
	
	// s2hr
	public static void addSender2HarbourRequestMapping(String fromId, String toId) {
		RegisterHandler.addMapping(Register.getInstance().getSenderId2HarbourRequestIds(),
				fromId, toId);
	}
	
	// s2hr remove
	public static void removeSender2HarbourRequestMapping(String fromId, String toId) {
		Register.getInstance().getSenderId2HarbourRequestIds().get(fromId).remove(toId);
	}
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// Adds + removes: Models
	///////////////////////////////////////////////////////////////////////////
	
	// DataEntity
	public static void addDataEntity(DataEntity de) {
		Register.getInstance().getDataEntityModels().put(de.getId(), de);
	}
	// DataEntity	
	public static void removeDataEntity(String id) {
		Register.getInstance().getDataEntityModels().remove(id);
	}
	
	// HarbourRequest
	public static void addHarbourRequest(HarbourRequest hr) {
		Register.getInstance().getHarbourRequestModels().put(hr.getId(), hr);
	}
	
	// HarbourRequest
	public static void removeHarbourRequest(String id) {
		Register.getInstance().getHarbourRequestModels().remove(id);
	}
	
	// Sender
	public static void addSender(Sender s) {
		Register.getInstance().getSenderModels().put(s.getId(), s);
	}
	
	// Sender
	public static void removeSender(String id) {
		Register.getInstance().getSenderModels().remove(id);
	}
	
	// DataSource
	public static void addDataSource(DataSource ds) {
		Register.getInstance().getDataSourceModels().put(ds.getId(), ds);
	}
	
	// DataSource
	public static void removeDataSorce(String id) {
		Register.getInstance().getDataSourceModels().remove(id);
	}
	
	// PersistenceResource
	public static void addPersistenceResource(PersistenceResource pr) {
		Register.getInstance().getPersistenceResourceModels().put(pr.getId(), pr);		
	}
	
	// PersistenceResource
	public static void removePersistenceResource(String id) {
		Register.getInstance().getPersistenceResourceModels().remove(id);		
	}
	
	
	///////////////////////////////////////////////////////////////////////////
	// Adds + removes: Lists
	///////////////////////////////////////////////////////////////////////////
	
	// DataEntityId
	public static void addDataEntityId(String id) {
		Register.getInstance().getDataEntityIds().add(id);
	}
	
	// DataEntityId
	public static void removeDataEntityId(String id) {
		Register.getInstance().getDataEntityIds().remove(id);
	}
	
	// UnpersistedHarbourRequestId
	public static void addUnpersistedHarbourRequestId(String id) {
		Register.getInstance().getUnpersistedHarbourRequestIds().add(id);
	}
	
	// UnpersistedHarbourRequestId
	public static void removeUnpersistedHarbourRequestId(String id) {
		Register.getInstance().getUnpersistedHarbourRequestIds().remove(id);
	}
	
	// HarbourRequestId
	public static void addHarbourRequestId(String id) {
		Register.getInstance().getHarbourRequestIds().add(id);
	}
	
	// HarbourRequestId
	public static void removeHarbourRequestId(String id) {
		Register.getInstance().getHarbourRequestIds().remove(id);
	}
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// Gets + updates: Models
	///////////////////////////////////////////////////////////////////////////
	
	public static HashMap getAllDataSourceModels() {
		return Register.getInstance().getDataSourceModels();
	}
	
	public static HashMap getAllPersistenceResourceModels() {
		return Register.getInstance().getPersistenceResourceModels();
	}
	
	public static HashMap getAllUnpersistedHarbourRequestModels() {
		HashMap<String, HarbourRequest> result = new HashMap<String, HarbourRequest>();
		TreeSet ids = Register.getInstance().getUnpersistedHarbourRequestIds();
		for (Iterator i = ids.iterator(); i.hasNext(); ) {
			String id = i.next().toString();
			HarbourRequest req = Register.getInstance().getHarbourRequestModels().get(id);
			result.put(id, req);
		}
		return result;
	}
	
	public static HashMap getAllSenderModels() {
		return Register.getInstance().getSenderModels();
	}
	
	public static HashMap getAllDataEntityModels() {
		return Register.getInstance().getDataEntityModels();
	}
	
	public static TreeSet getAllUnpersistedHarbourRequestIds() {
		return Register.getInstance().getUnpersistedHarbourRequestIds();
	}
	
	public static DataSource getDataSourceModel(String id) {
		return Register.getInstance().getDataSourceModels().get(id);
	}
	
	public static PersistenceResource getPersistenceResourceModel(String id) {
		return Register.getInstance().getPersistenceResourceModels().get(id);
	}
	
	public static HarbourRequest getHarbourRequestModel(String id) {
		return Register.getInstance().getHarbourRequestModels().get(id);
	}
	
	public static DataEntity getDataEntityModel(String id) {
		return Register.getInstance().getDataEntityModels().get(id);
	}
	
	public static Sender getSenderModel(String id) {
		return Register.getInstance().getSenderModels().get(id);
	}
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// Gets + updates: Models
	///////////////////////////////////////////////////////////////////////////

	public static TreeSet getHarbourRequestId2DataEntityIds(String id) {
		return Register.getInstance().getHarbourRequestId2DataEntityIds().get(id);
	}
	
	public static TreeSet getDataEntityId2DefinatorFieldIds(String id) {
		return Register.getInstance().getDataEntityId2DefinatorFieldIds().get(id);
	}
	
	public static TreeSet getDataSourceId2DefinatorTableIds(String id) {
		return Register.getInstance().getDataSourceId2DefinatorTableIds().get(id);
	}
	
	public static TreeSet<String> getDataSourceId2PersistenceResourceIds(String id) {
		return Register.getInstance().getDataSourceId2PersistenceResourceIds().get(id);
	}
	
	public static TreeSet getSenderId2DataSourceIds(String id) {
		return Register.getInstance().getSenderId2DataSourceIds().get(id);
	}
	
	public static TreeSet getSenderId2HarbourRequestIds(String id) {
		return Register.getInstance().getSenderId2HarbourRequestIds().get(id);
	}
	
	public static HashMap getAllHarbourRequestId2DataEntityIds(String id) {
		return Register.getInstance().getHarbourRequestId2DataEntityIds();
	}
	
	public static HashMap getAllDataEntityId2DefinatorFieldIds(String id) {
		return Register.getInstance().getDataEntityId2DefinatorFieldIds();
	}
	
	public static HashMap getAllDataSourceId2DefinatorTableIds(String id) {
		return Register.getInstance().getDataSourceId2DefinatorTableIds();
	}
	
	public static HashMap getAllDataSourceId2PersistenceResourceIds(String id) {
		return Register.getInstance().getDataSourceId2PersistenceResourceIds();
	}
	
	public static HashMap getAllSenderId2DataSourceIds(String id) {
		return Register.getInstance().getSenderId2DataSourceIds();
	}
	
	public static HashMap getAllSenderId2HarbourRequestIds(String id) {
		return Register.getInstance().getSenderId2HarbourRequestIds();
	}
	
	
	
	
	
	
	


	

}
